<template>
  <el-dialog
    v-model="centerDialogVisible"
    :title="title"
    align-center
    width="90%"
    destroy-on-close
    :close-on-click-modal="false"
  >
    <List :user-id="props.userId" :org-id="props.orgId" :token="props.token" />
  </el-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import List from './List.vue'

const centerDialogVisible = ref(false)

const title = ref('')
const props = ref({
  userId: '',
  orgId: '',
  token: ''
})

const show = async (t: string, params: { token?: string; userId?: string; orgId?: string }) => {
  if (params.token) {
    props.value.token = params.token
  }
  if (params.userId) {
    props.value.userId = params.userId
  }
  if (params.orgId) {
    props.value.orgId = params.orgId
  }
  title.value = t
  centerDialogVisible.value = true
}

//关闭表单
const hide = () => {
  centerDialogVisible.value = false
}

//暴露方法
defineExpose({ show, hide })
</script>
<style scoped lang="less"></style>
